import Link from "next/link"; import { notFound } from "next/navigation"; import { getRepo, getCommits } from "@/lib/api"; import { dec, decPath } from "@/lib/params"; import { timeAgo } from "@/lib/format"; type Props = { params: Promise<{ repo: string; ref?: string[] }> }; export default async function CommitsPage({ params }: Props) { const p = await params; const repo = dec(p.repo); const info = await getRepo(repo); if (!info) notFound(); const ref = p.ref?.length ? decPath(p.ref) : info.default; const commits = await getCommits(repo, ref); if (!commits) notFound(); return (
history of {ref} {commits.length === 100 && " ยท latest 100"}
{commits.length === 0 ? (No commits yet.
) : (